# 场景：使用Akshare跟踪不同资产的表现并生成投资组合报告

import akshare as ak

# 获取股票、基金和期货数据
stock_data = ak.stock_zh_a_daily(symbol="sz000001", start_date="2022-01-01", end_date="2022-12-31")
fund_data = ak.fund_etf_fund_info_em(fund="000001", start_date="2022-01-01", end_date="2022-12-31")
futures_data = ak.futures_zh_daily(symbol="cu2103", start_date="2022-01-01", end_date="2022-12-31")

# 计算不同资产的年度收益率
stock_return = (stock_data["close"].iloc[-1] - stock_data["close"].iloc[0]) / stock_data["close"].iloc[0]
fund_return = (fund_data["unit_nav"].iloc[-1] - fund_data["unit_nav"].iloc[0]) / fund_data["unit_nav"].iloc[0]
futures_return = (futures_data["close"].iloc[-1] - futures_data["close"].iloc[0]) / futures_data["close"].iloc[0]

# 打印投资组合报告
print("股票收益率：", stock_return)
print("基金收益率：", fund_return)
print("期货收益率：", futures_return)